package extras.salvation.api.methods;

import java.awt.Desktop;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URL;

/**
 * @author Salvation
 * @version 1.0
 * @since 20-08-2011
 */
public final class Salvation {

	private static final String STRING_LIST = "http://dl.dropbox.com/u/13317023/Salvation/RuneScape/RSBuddy/Scripts/Script%20List.txt";
	private static final String STRING_URL_BASE = "http://scripts.rsbuddy.com/?add=";
	
	/**
	 * @author Salvation
	 * @description Adds all scripts made by Salvation.
	 */
	public static void addScripts() {
		try {
			final URL urlList = new URL(STRING_LIST);
			final BufferedReader reader = new BufferedReader(new InputStreamReader(urlList.openStream()));
			String input = null;
			String url = null;

			while ((input = reader.readLine()) != null) {
				try {
					url = STRING_URL_BASE + input;
					Desktop.getDesktop().browse(URI.create(url));
				} catch (IOException a) {
					System.out.println(a.getMessage());
				}
			}
		} catch (Exception e) {

		}
	}
}